<?php

namespace IDock\Insurance\HBIC\Request;

use IDock\Insurance\HBIC\Bean\BASEPART;
use IDock\Insurance\HBIC\Bean\CAR;
use IDock\Insurance\HBIC\Bean\CARSHIPTAX;
use IDock\Insurance\HBIC\Bean\DEVICE;
use IDock\Insurance\HBIC\Bean\KIND;
use IDock\Insurance\HBIC\Bean\NOCAR;
use IDock\Insurance\HBIC\Bean\PERSONNEL;
use IDock\Insurance\HBIC\HBICEnums;
use IDock\Insurance\HBIC\Response\CommonResponse;
use IDock\Insurance\HBIC\Response\VehicleActualValueResponse;
use IDock\Visitor\VehicleActualValueVisitor;

class GetActualValueRequest extends AllHBICRequest
{
    public $requestType = 'A14';

    protected $response = VehicleActualValueResponse::class;

    protected $urlTip = '查询车辆实际价格';

    protected $resourceType = 'BXT';

    protected $methodName = 'getActualValue';

    /**
     * @var VehicleActualValueVisitor $visitor
     */
    protected $visitor;

    public function generate(): array
    {
        $param = [
            'resourceType' => $this->resourceType,
            'methodName' => $this->methodName,
            'CAR' => [
                'ENROLLDATE' => $this->visitor->firstRegisterDate,//初登日期
                'PURCHASEPRICE' => $this->visitor->vehiclePrice,//新车购置价
                'CARKINDCODE' => HBICEnums::$carKindCode[$this->visitor->carKindCode] ?? '',//车辆种类：CarKingCode（只做客车则默认：100）
                'USENATURECODE' => HBICEnums::$useNatureCode[$this->visitor->useNatureCode],//使用性质代码：UseNatureCode（只做非营业家庭自用客车，则不用传，可以默认，如不默认，则需要三个字段）
                'ENERGYTYPE' => HBICEnums::$energyType[$this->visitor->energyType] ?? '',//燃料（能源）种类,0-燃油；1-纯电动；2-燃料电池；3-插电式混合动力；4-其他混合动力；9-其他
                'SEATCOUNT' => $this->visitor->vehicleSeat,//座位数
                'TONCOUNT' => $this->visitor->vehicleTonnage,//核定载质量(kg) Sc
                'CARUSETYPE' => HBICEnums::$causeType[$this->visitor->causeType],//车辆用途
                'RISKCODE' => '0808',//险种代码（0808 商业险/0801 交强险
                'STARTDATE' => $this->visitor->startDate,//起保日期
            ],

        ];
        if(empty($param['CAR']['CARKINDCODE'])){
            throw new \Exception("不支持该车辆种类");
        }
        if($param['CAR']['ENERGYTYPE'] === ''){
            throw new \Exception("不支持该能源类型");
        }
        if(empty($param['CAR']['STARTDATE'])){
            throw new \Exception("起保日期不能为空");
        }
        return $param;
    }

    public function getStaffValue(&$comCode)
    {
        $comCode = $this->visitor->argc['comCode'] ?? '';
    }


}